package com.qf.om;

import javax.management.Attribute;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

public class SessionDataListener implements HttpSessionAttributeListener {
    @Override
    public void attributeAdded(HttpSessionBindingEvent event) {
        System.out.println("session添加了属性：" + event.getName() + " " + event.getValue());
    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent event) {
        HttpSessionAttributeListener.super.attributeRemoved(event);
    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent event) {
        System.out.println("session替换了属性：" +  event.getName() +
                " " +  event.getValue() + " 替换后:" +  event.getSession().getAttribute(event.getName()));
    }
}
